﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace Web
{
    public partial class ShowSanPham : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
            if (!IsPostBack)
            {
                LoadHA_ShowSPVang();
                LoadHA_DMSP();
            }
        }
        protected void LoadHA_ShowSPVang()
        {
            string connectionstring = ConfigurationManager.ConnectionStrings["cnn"].ConnectionString;
            SqlConnection conn = new SqlConnection(connectionstring);
            string sql = "select *  from SanPham where MaSo_LSP='BTV' ";
            SqlCommand cmd = new SqlCommand(sql, conn);
            SqlDataAdapter adapter = new SqlDataAdapter(cmd);
            conn.Open();
            conn.Close();
            DataSet ds = new DataSet();
            adapter.Fill(ds, "SanPham");

            Repeater1.DataSource = ds.Tables["SanPham"];
            Repeater1.DataBind();
        }

        protected void LoadHA_DMSP()
        {
            string connectionstring = ConfigurationManager.ConnectionStrings["cnn"].ConnectionString;
            SqlConnection conn = new SqlConnection(connectionstring);
            string sql = "select *  from LoaiSanPham where MaSo_CL='V' ";
            SqlCommand cmd = new SqlCommand(sql, conn);
            SqlDataAdapter adapter = new SqlDataAdapter(cmd);
            conn.Open();
            conn.Close();
            DataSet ds = new DataSet();
            adapter.Fill(ds, "LoaiSanPham");

            Repeater2.DataSource = ds.Tables["LoaiSanPham"];
            Repeater2.DataBind();
        }
    }
}